﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PeoplePickerPlus.Entities
{
    public class EntityGroupList
    {
        public EntityGroup[] ToArray()
        {
            return _email == null ? new EntityGroup[] { Users, Groups, SecurityGroups } : new EntityGroup[] { Users, Groups, SecurityGroups, Email };
        }

        EntityGroup _users = null;
        EntityGroup _groups = null;
        EntityGroup _securityGroups = null;
        EntityGroup _email = null;

        public EntityGroup Users
        {
            get
            {
                if (_users == null)
                {
                    _users = new EntityGroup(){ Grouping = "Users" };
                }
                return _users;
            }
        }

        public EntityGroup Groups
        {
            get
            {
                if (_groups == null)
                {
                    _groups = new EntityGroup() { Grouping = "Groups" };
                }
                return _groups;
            }
        }

        public EntityGroup SecurityGroups
        {
            get
            {
                if (_securityGroups == null)
                {
                    _securityGroups = new EntityGroup() { Grouping = "Security Groups" };
                }
                return _securityGroups;
            }
        }

        public EntityGroup Email
        {
            get
            {
                if (_email == null)
                {
                    _email = new EntityGroup() { Grouping = "Email" };
                }
                return _email;
            }
        }
    }
}
